<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- <script src="http://lib.sinaapp.com/js/jquery/1.9.1/jquery-1.9.1.min.js" type="text/javascript"></script> -->
<script type="text/javascript" src="../jquery-2.1.1.js"></script>
<title>自定义事件的实现</title>
</head>
<body>

<div id="maopao">
  <div id="aaron">
     <div id='test'>
        <ul>
          <p>trigger触发</p>
        </ul>
     </div>
  </div>
</div>

<div id="show"></div>

<script type="text/javascript">

var s = $('#show');

// s.on('custom', function(event, param1, param2) {
//   show(param1 + "\n" + param2);
// });

// s.trigger('custom', ['Custom', 'Event']);

var test = $('#test');

$("body").click(function(event,data){
	show('body '+data)
})

$(window).click(function(event,data){
	show('window '+data)
})

test.on('click','p', function() {
	show('p')
});

test.on('click', function(event,data) {
	show('test '+data)
});

test.trigger('click',2222);

function show(data){
  $("#show").append('<li>'+ data +'</li>')
}

</script> 

</body>
</html>









